// 装备表
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;

const EquipmentSchema = new Schema({
    name: String,
    info: String,//介绍
    img: String,//图片
    rare_level: { //稀有等级  0普通 1难得 2罕见 3稀有 4传说 5神话
        type: Number,
        default: 0
    },
    price: Number, //固定价格
    is_sell: {
        type: Number,
        default: 0 //0不可交易 1可以交易
    },
    is_system_sell: {
        type: Number,
        default: 0  //0不可 1系统商店出售
    },
    // 装备力量属性最大值
    max_strength: {
        type: Number,
        default: 0
    },
    // 装备体质属性最大值
    max_defense: {
        type: Number,
        default: 0
    },
    // 装备灵力属性最大值
    max_magic: {
        type: Number,
        default: 0
    },
    // 装备速度属性最大值
    max_speed: {
        type: Number,
        default: 0
    },
    // 装备命中属性最大值
    max_accuracy: {
        type: Number,
        default: 0
    },
    //装备类型
    equipments_type: {
        type: ObjectId,
        ref: "Equipment_Type"
    },
    task: { // 关联任务需求
        type: ObjectId,
        ref: "Task"
    },
    created_at: {
        type: Date,
        default: new Date()
    }
});

module.exports = Equipment = mongoose.model("equipments", EquipmentSchema);